home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -in_the_mag- / reader_requests / dice_v3.15 / lib / amigalib / createextio.c < prev    next >
C/C++ Source or Header  |  1999-01-26  |  1KB  |  60 lines

  1.  
  2. /*
  3.  *  CreateExtIO.C   (1.3/2.0) (for 2.0 only apps use CreateIORequest())
  4.  *
  5.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  6.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  7.  *    DICE-LICENSE.TXT.
  8.  *
  9.  */
  10.  
  11. #include <exec/types.h>
  12. #include <exec/ports.h>
  13. #include <exec/memory.h>
  14. #include <exec/io.h>
  15. #ifdef INCLUDE_VERSION        /*    2.0 */
  16. #include <clib/exec_protos.h>
  17. #include <clib/alib_protos.h>
  18. #else
  19. extern void *AllocMem(long, long);
  20. extern void FreeMem(void *, long);
  21. #endif
  22.  
  23. #ifndef HYPER
  24. #define HYPER
  25. #endif
  26.  
  27. typedef struct MsgPort    MsgPort;
  28. typedef struct IORequest IORequest;
  29. typedef struct IOStdReq  IOStdReq;
  30.  
  31. IORequest *
  32. HYPER ## CreateExtIO(replyPort, size)
  33. MsgPort *replyPort;
  34. long size;
  35. {
  36.     IORequest *io = NULL;
  37.  
  38.     if (replyPort) {
  39.     if (io = AllocMem(size, MEMF_PUBLIC | MEMF_CLEAR)) {
  40.         io->io_Message.mn_ReplyPort = replyPort;
  41.         io->io_Message.mn_Length = size;
  42.         io->io_Message.mn_Node.ln_Type = NT_REPLYMSG;
  43.     }
  44.     }
  45.     return(io);
  46. }
  47.  
  48. void
  49. DeleteExtIO(io)
  50. IORequest *io;
  51. {
  52.     if (io) {
  53.     long bad = -1;
  54.     io->io_Message.mn_Node.ln_Succ = (void *)bad;
  55.     io->io_Device = (void *)bad;
  56.     FreeMem(io, io->io_Message.mn_Length);
  57.     }
  58. }
  59.  
  60.